package demo1;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 创建一个Spring容器
 * 并从容器中分别获取User和Person，调用他们的方法。
 */
public class Test {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context
                = new AnnotationConfigApplicationContext("demo1");
        User user = context.getBean(User.class);
        user.sayHello();

        Person person = context.getBean(Person.class);
        person.sayHi();
    }
}
